<template>
  <div class="home">
    <!-- 大轮播图部分 -->
    <div class="main-carousel-container">
      <el-carousel height="500px">
        <el-carousel-item v-for="(item, index) in carouselItems" :key="index">
          <div class="carousel-item" :style="{ backgroundImage: `url(${item.image})` }">
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>

    <!-- 主内容区 -->
    <div class="section-content">
      <div class="grid-container">
        <!-- 左侧部分 -->
        <div class="left-section">
          <div class="section-header">
            <!-- 小轮播图 -->
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
              <el-menu-item index="1">集团新闻</el-menu-item>
              <el-menu-item index="2">项目动态</el-menu-item>
              <el-menu-item index="3">媒体报道</el-menu-item>
            </el-menu>
            <el-button type="text" class="more-btn">
              <el-icon class="more-icon"><Plus /></el-icon>更多
            </el-button>
          </div>

          <div class="left-content">
            <!-- 小轮播图 -->
            <div class="left-left"> 
              <div class="small-carousel-container">
                <el-carousel :interval="4000" arrow="always" height="300px">
                  <el-carousel-item v-for="(item, index) in carouselItems" :key="index">
                    <div class="carousel-item" :style="{ backgroundImage: `url(${item.image})` }"></div>
                  </el-carousel-item>
                </el-carousel>
              </div>
            </div>
            <div class="left-right">
              <!-- 新闻标题 -->
              <div v-for="(news, index) in newsList" :key="index" class="news-item">
                <span>{{ news.date }}</span>
                <a href="#">{{ news.title }}</a>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 右侧部分 -->
        <div class="right-section">
          <div class="section-header">
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
              <el-menu-item index="1">集团简介</el-menu-item>
            </el-menu>
            <el-button type="text" class="more-btn">
              <el-icon class="more-icon"><Plus /></el-icon>更多
            </el-button>
          </div>
          <div class="content">
            <p>
              才知集团历经发展，原创于1999年，位于中国美丽浪漫的海滨城市——珠海经济特区。才知集团由杨子才先生从零开始，从无到有，从小到大，通过才知人不懈的努力和永不放弃的精神发展成为现在的综合型集团公司。
            </p>
            <p>
              才知集团的主营业务为，商业与住宅地产开发，饮食酒店连锁，农业旅游，国际贸易与投资。
            </p>
            <p>
              集团以合营的经营理念布局，由长期与短期的产业投资结构并进发展。努力在所经营的行业内不断创新经营模式和管理模式，以做企业为本，做百年企业为短，做对社会有价值的企业为目标的宏旨，熟读……
            </p>
          </div>
        </div>
      </div>
    </div>

    <!-- 精彩照片模块 -->
     <div class="photo-container">
      <div class="section-header">
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
              <el-menu-item index="1">精彩照片</el-menu-item>
            </el-menu>
            <el-button type="text" class="more-btn">
              <el-icon class="more-icon"><Plus /></el-icon>更多
            </el-button>
      </div>
      <div class="photo-list">
            <el-card v-for="(item, index) in photoItems" :key="index" class="photo-item">
            <img :src="item.src" alt="Photo" class="photo-image" />
              <div class="photo-title">{{ item.title }}</div>
            </el-card>
      </div>
     </div>
    <!-- 精彩视频模块 -->
    <div class="photo-container">
      <div class="section-header">
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
              <el-menu-item index="1">精彩视频</el-menu-item>
            </el-menu>
            <el-button type="text" class="more-btn">
              <el-icon class="more-icon"><Plus /></el-icon>更多
            </el-button>
      </div>
      <div class="photo-list">
            <el-card v-for="(item, index) in photoItems" :key="index" class="photo-item">
            <img :src="item.src" alt="Photo" class="photo-image" />
              <div class="photo-title">{{ item.title }}</div>
            </el-card>
      </div>
     </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Plus } from '@element-plus/icons-vue'

const newsList = ref([
  { date: '24-07-24', title: '严正声明' },
  { date: '25-02-27', title: '华发集团获中国企业改革发展优秀成果一等奖' },
  { date: '25-02-17', title: '珠海高新区与华发集团签署战略合作协议' },
  { date: '25-02-06', title: '华发集团一批重点产业项目集中签约、动工' },
  { date: '25-01-20', title: '华发集团2024年逆势完成年度经营任务' },
  { date: '25-01-15', title: '公告' }
]);
const carouselItems = ref([
  {
    image: '/src/assets/lunbo1.png'
  },
  {
    image: '/src/assets/lunbo2.png'
  },
  {
    image: '/src/assets/lunbo1.png'
  }
])

const photoItems = ref([
  { src: '/src/assets/lunbo1.png', title: '集团新战略助力业务增长' },
  { src: '/src/assets/lunbo1.png', title: '项目动态：新进展曝光' },
  { src: '/src/assets/lunbo1.png', title: '媒体聚焦：集团新动向' },
  { src: '/src/assets/lunbo1.png', title: '才知历程：十年磨一剑' },
  { src: '/src/assets/lunbo1.png', title: '休闲旅游业务拓展新区域' },
]);
const videoItems = ref([
  { src: 'path/to/news1.png', title: 'Title 1' },
  { src: 'path/to/news2.png', title: 'Title 2' },
  { src: 'path/to/news3.png', title: 'Title 3' },
  { src: 'path/to/news1.png', title: 'Title 4' },
  { src: 'path/to/news1.png', title: 'Title 6' },
  { src: 'path/to/news1.png', title: 'Title 7' },
]);
</script>

<style scoped>
.home {
  width: 1200px;
  position: relative;
}

.main-carousel-container {
    position: relative;
    width: 100vw; /* 视口宽度 */
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    z-index: 10; /* 确保轮播图在其他内容之上 */
}

.small-carousel-container {
  width: 100%;
}

.carousel-item {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.carousel-content {
  text-align: center;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  max-width: 800px;
  margin: 0 auto;
}

.carousel-content h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
}

.carousel-content p {
  font-size: 1.2em;
  line-height: 1.6;
}

.section {
  padding: 60px 0;
}

.section-content {
  max-width: 1200px;
  margin: 0 0;
}

.section-title {
  text-align: center;
  font-size: 2em;
  margin-bottom: 30px;
  color: #333;
}

.section-text {
  text-align: center;
  font-size: 1.1em;
  color: #666;
  max-width: 800px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.news-section {
  background-color: #f5f7fa;
}

.news-card {
  margin-bottom: 20px;
  transition: transform 0.3s;
}

.news-card:hover {
  transform: translateY(-5px);
}

.news-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.news-content {
  padding: 15px;
}

.news-content h3 {
  margin: 0 0 10px;
  font-size: 1.2em;
  color: #333;
}

.news-content p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
  line-height: 1.5;
}

/* 自定义轮播图箭头样式 */
:deep(.el-carousel__arrow) {
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 24px;
  color: #fff;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  transform: translateY(-50%);
}

:deep(.el-carousel__arrow:hover) {
  background-color: rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

:deep(.el-carousel__arrow--left) {
  left: 20px;
}

:deep(.el-carousel__arrow--right) {
  right: 20px;
}

/* 调整轮播图指示器样式 */
:deep(.el-carousel__indicators) {
  bottom: 20px;
}

:deep(.el-carousel__button) {
  width: 30px;
  height: 3px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 3px;
}

:deep(.el-carousel__indicator.is-active .el-carousel__button) {
  background-color: #fff;
  width: 40px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 0;
  box-sizing: border-box;
}

.grid-container {
  display: grid;
  grid-template-columns: 65% 35%;
  gap: 0;
  width: 100%;
}

.left-section, .right-section {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  min-width: 0;
  box-sizing: border-box;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.el-menu-demo {
  background-color: rgb(172, 156, 66);
  border-bottom: 1px solid #eaeaea;
  font-size: 20px;
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

:deep(.el-menu-item) {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.more-btn {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #8B4513 !important;
  padding: 0;
  margin: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: 2;
  font-size: 14px;
}

.more-btn:hover {
  color: #FFD700 !important;
}

.more-btn:focus {
  color: #8B4513 !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.more-icon {
  margin-left: 4px;
  font-size: 16px;
}

.left-content {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 20px;
  margin-top: 20px;
}

.left-left, .left-right {
  min-width: 0;
}

.content {
  padding: 0;
  background-color: transparent;
  border: none;
}

.content p {
  margin-bottom: 15px;
  line-height: 1.6;
  color: #666;
}

.content p:last-child {
  margin-bottom: 0;
}

.carousel-item {
  color: #fff;
  font-size: 18px;
  text-align: center;
  line-height: 300px;
}

.news-card {
  height: 40px; 
}

.news-item {
  display: flex;
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px dashed #ccc;
}

.news-item:last-child {
  border-bottom: none;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* 自动填充，最小宽度200px */
  gap: 20px; /* 设置网格项之间的间距 */
  max-width: 1200px;
  margin: 0 0; /* 居中对齐 */
}

.photo-item {
  display: flex;
  height: 200px;
  width: 100%; /* 宽度自适应 */
  flex-direction: column;
  align-items: center; /* 垂直居中对齐 */
}

.photo-image {
  width: 100%; /* 图片宽度自适应容器 */
  height: auto; /* 图片高度自动 */
  border-radius: 8px; /* 圆角 */
}

.photo-title {
  margin-top: 10px; /* 标题与图片之间的间距 */
  font-size: 16px; /* 标题字体大小 */
  text-align: center; /* 标题居中对齐 */
}

.news-item a {
  padding-left: 30px;
}
</style> 